export default {
	name: 'TableChart',
	props: {
		chartTitle: {
			type: String
		},
		tableTitles: {
			type: Array
		},
		tableList: {
			type: Array
		}
	},
	data() {
		return {}
	},
	created() {
		this.handleTableTitles()
	},
	methods: {
		computeLineColor(index, tableLen) {
			//不管是奇数还是偶数项：保证最后一项返回白色
			if (tableLen % 2 != 0) {
				return index % 2 == 0 ? '#FFFFFF' : '#F2F5FA'
			} else {
				return index % 2 == 0 ? '#F2F5FA' : '#FFFFFF'
			}
		},
		//给【表格】【列标题】添加【换行文本】
		handleTableTitles() {
			this.tableTitles.forEach(valItem => {
				let titleTest = valItem.title
				// console.log('titleTest', titleTest)
				valItem.titleH5 = valItem.title.replace(/\n/g, '<br>')
			})
		}
	}
}
